{template 'header'}
{template 'inc_model/banner02'}
<div class="container">
    <div class="bread_nav">
        当前位置: <a href="{$MODULE[1][linkurl]}">首页</a> &raquo; <a href="{$EXT[guestbook_url]}">网站咨询</a>
    </div>
    <div>
        <form class="form-horizontal" action="{$EXT[guestbook_url]}index.php" method="post" onsubmit="return check();">
            <div class="form-group">
                <label class="col-sm-2 control-label">咨询类型：</label>
                <div class="col-sm-3">
                    <select class="form-control" name="post[type]" id="type">
                        {loop $TYPE $k $v}
                        <option value="{$v}">{$v}</option>
                        {/loop}
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label"><span style="color: red;">*</span> 咨询内容：</label>
                <div class="col-sm-9">
                    <textarea id="content" class="form-control" name="post[content]" rows="5">{$content}</textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">与您联系：</label>
                <div class="col-sm-9">
                    <label class="radio-inline">
                        <input type="radio" name="my" value="1" id="my_1"/> 需要
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="my" value="0" id="my_0" checked> 不需要
                    </label>
                </div>
            </div>
            <script>
                $(function (){
                    $("input:radio").click(function (){
                        var v=$(this).val();
                        if(v==1){
                            $(".lx").show();
                        }else{
                            $(".lx").hide();
                        }
                    });
                })
            </script>
            <div class="lx" style="display: none;">
                <div class="form-group">
                    <label class="col-sm-2 control-label">联系人：</label>
                    <div class="col-sm-5">
                        <input type="text" class="form-control" placeholder="" name="post[truename]" id="truename" value="{$truename}">
                    </div>
                    <div class="col-sm-5">
                        <div class="checkbox">
                            <label for="hidden">
                                <input type="checkbox" name="post[hidden]" value="1" id="hidden" checked> 匿名咨询
                            </label>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">联系电话：</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" placeholder="" name="post[telephone]" id="telephone" value="{$telephone}">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">电子邮件：</label>
                    <div class="col-sm-10">
                        <input type="email" class="form-control" placeholder="" name="post[email]" id="email" value="{$email}">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">QQ：</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" placeholder="" name="post[qq]" id="qq" value="{$qq}">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">阿里旺旺：</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" placeholder="" name="post[ali]" id="ali" value="{$ali}">
                    </div>
                </div>
            </div>
            {if $MOD[guestbook_captcha]}
            <div class="form-group">
                <label class="col-sm-2 control-label">验证码：</label>
                <div class="col-sm-5">
                    {template 'captcha', 'chip'}
                </div>
            </div>
            {/if}
            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-9">
                    <button type="submit" name="submit" class="btn btn-success">提交</button>&nbsp;&nbsp;
                    <button type="reset" class="btn btn-danger">重写</button>
                </div>
            </div>
        </form>
        {if $lists}
        <div class="margin_bottom_20">
            <form class="form-inline text-center" action="{$EXT[guestbook_url]}index.php">
                <div class="input-group">
                    <label for=""><strong>关键词：</strong></label>
                    <div class="input-group">
                        <input type="text" class="form-control" placeholder="搜索关键字..." name="kw" value="{$kw}">
                        <span class="input-group-btn">
                            <button class="btn btn-default" type="submit">搜索</button>
                        </span>
                    </div>
                </div><!-- /input-group -->
            </form>
        </div>
        <div style="padding: 20px;">
            {loop $lists $k $v}
            <dl class="dl-horizontal">
                <dt style="width: 300px;">{if $v[hidden]}匿名{else}{$v[truename]}{/if} <span class="px11">{$v[adddate]}</span> 提问：</dt>
                <dd>{$v[content]}</dd>
                {if $v[reply]}
                <dt style="width: 300px;">网站 <span class="px11">{$v[editdate]}</span> 回复：</dt>
                <dd style="color: red;">{$v[reply]}</dd>
                {/if}
            </dl>
            {/loop}
            {if $pages}<div class="pages">{$pages}</div>{/if}
            {/if}
        </div>
    </div>
</div>
{load('guest.js')}
<script type="text/javascript">
function check() {
	var l;
	var f;
	f = '#content';
	l = $(f).value.length;
	if(l < 5 || l > 1000) {
		Dmsg('内容应为5-1000字，当前已输入'+l+'字', f);
		return false;
	}
	{if $MOD[guestbook_captcha]}
	f = 'captcha';
	l = $(f).value;
	if(!is_captcha(l)) {
		Dmsg('请填写验证码', f);
		return false;
	}
	{/if}
	return true;
}
{if $action == 'report'}
    $('#type').val('不良信息');
    $('#content').value = Dd('content').value+"\n-------------------------------\n举报理由：\n";
{/if}
</script>
{template 'footer'}